package com.xiyou.leetcode;

import java.util.*;

public class StrReplace {
    public static void main(String[] args) {

        String str = "hellohehihihihi";

        List<String> standerList = new ArrayList<>();
        standerList.add("he");
        standerList.add("hello");
        standerList.add("hi");
        Collections.sort(standerList, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o2.length() - o1.length();
            }
        });

        for (String s : standerList) {
            str = str.replaceAll(s, "");
        }

        if (str.length() == 0) {
            System.out.println(true);
        } else {
            System.out.println(false);
        }
    }
}
